/*
 * Copyright (C) 2001-2005 Pleasant nightmare studio
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.pleasantnightmare.gblade.data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author deus
 * @version 1.0
 * @since Sep 9, 2009 12:53:21 PM
 */
public class PropertyData {
  private String name;
  private Object value;
  private List<PropertyData> children;

  public PropertyData() {
    this("", null);
  }

  public PropertyData(String name, Object value) {
    this.name = name;
    this.value = value;
    children = new ArrayList<PropertyData>();
  }

  public void addPropertyData(PropertyData property) {
    children.add(property);
  }

  public void addPropertyData(String name, Object value) {
    children.add(new PropertyData(name, value));
  }

  public void removePropertyData(PropertyData property) {
    children.remove(property);
  }

  public boolean containsPropertyData(PropertyData property) {
    return children.contains(property);
  }

  public List<PropertyData> getChildren() {
    return children;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Object getValue() {
    return value;
  }

  public void setValue(Object value) {
    this.value = value;
  }

  @Override public String toString() {
    return String.format("PropertyData{name='%s'\'', value=%s'}'", name, value);
  }
}
